Structure for handling data requests

ABSTRACT

A design structure embodied in a machine readable storage medium for designing, manufacturing, and/or testing a design is provided. The design structure generally includes a computer system that includes a CPU, a memory controller, memory, a bus connecting the CPU, memory controller and memory, circuitry for providing a speculative read threshold corresponding to a selected percentage of the total number of reads that can be speculatively issued, and circuitry for intermixing demand reads and speculative reads in accordance with the speculative read threshold.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation-in-part of co-pending U.S. patent application Ser. No. 11/953,255, filed Dec. 10, 2007, which is herein incorporated by reference.

BACKGROUND OF THE INVENTION Field of Invention

The present invention relates in general to design structures, and more specifically, designs structures for computer systems and, more particularly, to handling data requests in computer systems.

In order to create a large computing system capable of running many tasks concurrently, it is usually necessary to provide multiple copies of data used by the tasks so that there is often one physically close to the processor running the task. These copies are stored in caches which can be constructed in a variety of sizes and organizations. When a particular process needs a data item, one or more of these caches are searched to see if they contain the desired data and if they do not, then the request will be passed to a memory controller which manages a much larger memory space known as main memory. The goal of maintaining multiple copies of data is to reduce the average amount of time is takes for a particular processor to access the data item that it needs. Searching the caches takes a certain amount of time and if the desired data is not located, that time is added to the total access time required to retrieve the data from the main memory. Thus is can be beneficial to start the access to main memory before it is known whether or not the desired data item is in one of the caches. This is known as a speculative read because if the data is found in a cache, that data will be used and the data retrieved from main memory will be discarded. The other case in which all caches that might possibly contain the desired data are searched before the access to main memory is started is known as a demand read. The drawback to speculative reads is that they consume memory and bus resources which are then not available for data requests other processes.

Accordingly, there is a need in the art for proper weighting between demand and speculative reads to minimize read latency and maximize performance of a memory subsystem.

SUMMARY OF THE INVENTION

The problems outlined above may at least in part be solved in some examples by the disclosed system and method for handling data requests.

In one example, a method for handling speculative read requests for a memory controller in a computer system is provided. The method includes the steps of providing a speculative read threshold corresponding to a selected percentage of the total number of reads that can be speculatively issued, and intermixing demand reads and speculative reads in accordance with the speculative read threshold.

In one example, a computer system includes a CPU, a memory controller, memory, a bus connecting the CPU, memory controller and memory, circuitry for providing a speculative read threshold corresponding to a selected percentage of the total number of reads that can be speculatively issued, and circuitry for intermixing demand reads and speculative reads in accordance with the speculative read threshold.

In one example, a method for handling speculative read requests for a memory controller in a computer system is provided. The method includes the steps of providing a speculative dispatch time threshold corresponding to a selected percentage of a period of time required to search a cache of the computer system, and intermixing demand reads and speculative reads in accordance with the speculative dispatch time threshold.

In one example a design structure embodied in a machine readable storage medium for at least one of designing, manufacturing, and testing a design is provided. The design structure generally includes a computer system that includes a CPU, a memory controller, memory, a bus connecting the CPU, memory controller and memory, circuitry for providing a speculative read threshold corresponding to a selected percentage of the total number of reads that can be speculatively issued, and circuitry for intermixing demand reads and speculative reads in accordance with the speculative read threshold.

The foregoing has outlined rather generally the features and technical advantages of one or more examples of the present invention in order that the detailed description of the present invention that follows may be better understood. Additional features and advantages of the present invention will be described hereinafter which may form the subject of the claims of the present invention.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing and other features and aspects of the present invention will be best understood with reference to the following detailed description of a specific example of the invention, when read in conjunction with the accompanying drawings, wherein:

FIG. 1 is an example of a computer system;

FIG. 2 is a sketch of a DRAM subsystem;

FIG. 3 is a graph showing the average access time for the DRAM subsystem shown in FIG. 2;

FIG. 4 is a graph showing the average delay caused by bank collisions for the DRAM subsystem shown in FIG. 2;

FIG. 5 is a Venn diagram showing the relationship between read types;

FIG. 6 is a graph showing the average read latency for a system with 25% demand reads;

FIGS. 7 a-7 f are graphs showing normalized read latency for systems with 10%, 25%, 40%, 55%, 70%, and 85% demand reads, respectively; and

FIG. 8 is an example of algorithm functions of the speculative read threshold algorithm.

FIG. 9 is a flow diagram of a design process used in semiconductor design, manufacture, and/or test.

DETAILED DESCRIPTION OF THE INVENTION

In the following description, numerous specific details are set forth to provide a thorough understanding of the present invention. However, it will be apparent to those skilled in the art that the present invention may be practiced without such specific details. In other instances, well-known circuits have been shown in block diagram form in order not to obscure the present invention in unnecessary detail. For the most part, details considering timing considerations and the like have been omitted inasmuch as such details are not necessary to obtain a complete understanding of the present invention and are within the skills of persons of ordinary skill in the relevant art.

A system and method for dynamically adjusting the number of speculative read requests based upon the memory controller workload and rate of incoming requests to reduce memory read latency are provided. In one example, a system and method uses a speculative read threshold algorithm to dynamically intermix demand and speculative memory requests to improve latency. FIG. 1 and the associated description describe an example of a computer system for practicing the disclosed system and method. FIGS. 2-7, Equations 1-46, and the related description describe the derivation of an example of the speculative read threshold algorithm. FIG. 8, Equation 47, Table 1 and the associated description describe an example of the speculative read threshold algorithm.

FIG. 1 Computer System

FIG. 1 illustrates an example of a hardware configuration of computer system 100 which is representative of a hardware environment for practicing examples of the disclosed system and method. Computer system 100 may have a multi-processor system 110 coupled to various other components by system bus 112. An operating system 140 may run on multi-processor system 110 and provide control and coordinate the functions of the various components of computer system 100. Software programs or applications 150 in accordance with examples of the disclosed system and method may run in conjunction with operating system 140 and provide calls to operating system 140 where the calls implement the various functions or services to be performed by application 150.

Referring to FIG. 1, Read-Only Memory (ROM) 116 may be coupled to system bus 112 and include a basic input/output system (“BIOS”) that controls certain basic functions of computer system 100. Random access memory (RAM) 114 and disk adapter 118 may also be coupled to system bus 112. RAM 114 may comprise dynamic random access memory (DRAM), among other types of memory. It should be noted that software components including operating system 140 and application 150 may be loaded into RAM 114, which may be computer system's 100 main memory for execution. Disk adapter 118 may be an integrated drive electronics (“IDE”) adapter that communicates with a disk unit 120, e.g., disk drive.

Referring to FIG. 1, multi-processor system 110 may comprise a first processor 104 and a second processor 106. First and second processors 104 and 106 may each comprise CPU core 142, L1 cache 144 and L2 cache 146. Computer system 100 may comprise memory controller 108 to manage the flow of data to and from the memory of computer system 100, e.g., ROM 116 and RAM 114. Computer system 100 comprises coherency protocol interrogation logic 148 to maintain coherency between first and second processors 104 and 106. Computer system 100 may comprise speculative read threshold algorithm logic 160 to dynamically intermix demand and speculative memory requests in accordance with examples of the disclosed system and method. For example, first processor 104 may issue broadcast read request 152 which is received by logic 148 and logic 160. Logic 160 then outputs logic output 154 to memory controller 108 to indicate whether a speculative read will reduce memory read latency. If so, memory controller 108 may issue speculative read 156. Next, logic 148 issues coherency protocol interrogation 158 to second processor 106. Depending on the result of this interrogation, logic 148 may indicate, via signal 162, that a demand read 164 is needed. Memory controller 108 may recognize demand reads 164 that duplicate previous speculative reads 156. RAM 114 may return read data 166 to first processor 104 in response to either speculative read 156 or demand read 164. Memory controller 108 may provide feedback 168 to logic 160, e.g., to provide parameters for the speculative read threshold algorithm.

Referring to FIG. 1, computer system 100 may further include a communications adapter or network card 134 coupled to bus 112. Communications adapter 134 may interconnect bus 112 with network 102 enabling computer system 100 to communicate with other devices over network 102. I/O devices may also be connected to computer system 100 via a user interface adapter 122 and display adapter 136. Keyboard 124, mouse 126 and speaker 130 may all be interconnected to bus 112 through user interface adapter 122. Data may be inputted to computer system 100 through any of these devices. A display monitor 138 may be connected to system bus 112 by display adapter 136. In this manner, a user is capable of inputting to computer system 100 through keyboard 124 or mouse 126 and receiving output from computer system 100 via display 138 or speaker 130.

The various aspects, features, examples or implementations of the disclosed system and method described herein can be used alone or in various combinations. The disclosed methods can be implemented by software, hardware or a combination of hardware and software. The disclosed system and method can also be embodied as computer readable code on a computer readable medium. The computer readable medium is any data storage device that can store data which can thereafter be read by a computer system. Examples of the computer readable medium include read-only memory, random access memory, CD-ROMs, flash memory cards, DVDs, magnetic tape, optical data storage devices, and carrier waves. The computer readable medium can also be distributed over network-coupled computer systems so that the computer readable code is stored and executed in a distributed fashion.

FIG. 2 DRAM Subsystem

FIG. 2 illustrates an example of a dynamic random access memory (DRAM) 114 a. For the purposes of the following discussion concerning the calculation of access times (Tram_access), DRAM 114 a may be viewed as a collection of multiple independent resources, banks 115. The example of DRAM 114 a shown in FIG. 2 comprises sixteen banks 115, shown as B0-B15. The dynamic nature of the storage elements within each bank 115 results in a bank busy penalty whenever multiple reads to the same bank 115 occur within the bank busy window (Tbb). While the address space of memory controller 108 a is divided evenly across all banks 115, the probability of multiple system read addresses mapping to the same bank 115 should be taken into account. Because the number of reads greatly exceeds the number of writes for the typical conventional system, the effect of writes on bank 115 accessibility may be ignored in the following analysis.

In the simple case where no bank access collisions occur, DRAM access times may be viewed as the sum of the minimum raw access time (Ta) and the read transfer time (Trd) as shown below in Equation 1:

T _(ram) _(—) _(access) =T _(a) +T _(rd) ≡T _(ram) _(—) _(access) _(—) _(min)  (1)

If bank collisions are considered, then additional factors may be considered, including the pattern of read address accesses; the total number of banks 164 in DRAM subsystem 162 (Nb); the current bandwidth utilization (UTILpercentage) and the bank busy precharge window (Tbb). Typically, bank access collisions only occur when multiple reads occur within the bank busy window (Tbb). Because each read transfer (Trd) takes a finite length of time, the average penalty due to the bank busy window (Tbb_delay_average) may be expressed as a probability. For example, a penalty is incurred only in cases where the current read, e.g., RD0, also matches a read access to the same bank 164 within the past bank busy window (Tbb). Accordingly, P(RDn) may be defined as the probability that another read to the same bank 164 as the current read occurred no earlier than n read transfer time slots ago, e.g., n is the number of time slots within the bank busy window (Tbb) that should be considered when looking for a bank access collision. As a result, the average penalty due to the bank busy window (Tbb_delay_average) may be expressed as shown below in Equation 2:

$\begin{matrix} \begin{matrix} {T_{{bb\_ delay}{\_ average}} = {T_{bb} - \left( {{P\left( {RD}_{1} \right)} \times \left( {1 \times T_{rd}} \right)} \right) -}} \\ {{\left( {{P\left( {RD}_{2} \right)} \times \left( {2 \times T_{rd}} \right)} \right) -}} \\ {\left( {{P\left( {RD}_{n} \right)} \times \left( {n \times T_{rd}} \right)} \right)} \\ {{{{where}\mspace{14mu} n} \leq {T_{bb}/T_{rd}}} = {{number}\mspace{14mu} {{of}\mspace{14mu} {''}}{time}\mspace{14mu} {{slots}{''}}\mspace{14mu} {within}\mspace{14mu} {the}\mspace{14mu} {bank}}} \\ {{{busy}\mspace{14mu} {window}\mspace{14mu} {that}\mspace{14mu} {must}\mspace{14mu} {be}\mspace{14mu} {considered}}} \\ {{{when}\mspace{14mu} {looking}\mspace{14mu} {for}\mspace{14mu} a\mspace{14mu} {bank}\mspace{14mu} {access}}} \\ {{collision}} \end{matrix} & (2) \end{matrix}$

The average access time (Tram_access_average) may be expressed as shown below in Equation 3:

T _(ram) _(—) _(access) _(—) _(average) =T _(a) +T _(rd) +T _(bb) _(—) _(delay) _(—) _(average)  (3)

As discussed below, bandwidth utilization may affect the average access time (Tram_access_average). Bandwidth may be described as the number of reads processed in a given time period. Accordingly, bandwidth (BWbb_read) may be expressed in terms of the number of reads (RDbb_read) that occur on average during every bank busy window (Tbb) as shown below in Equation 4:

BW_(bb) _(—) _(read)=RD_(bb) _(—) _(read) /T _(bb)  (4)

The maximum bandwidth (BWbb_max_read) may be expressed in terms of the maximum number of reads (RDbb_max_read) as shown below in Equations 5-7:

RD_(bb) _(—) _(read)≦RD_(bb) _(—) _(max) _(—) _(read)  (5)

RD_(bb) _(—) _(max) _(—) _(read) =T _(bb) /T _(rd)  (6)

BW_(bb) _(—) _(max) _(—) _(read)=RD_(bb) _(—) _(max) _(—) _(read) /T _(bb)  (7)

Current bandwidth utilization (UTILpercentage) may be expressed as shown below in Equation 8:

$\begin{matrix} \begin{matrix} {{UTIL}_{percentage} = {{BW}_{bb\_ read}/{BW}_{{bb\_ max}{\_ read}}}} \\ {= {{RD}_{bb\_ read}/{RD}_{{bb\_ max}{\_ read}}}} \end{matrix} & (8) \end{matrix}$

Assuming that the pattern of read accesses follows a uniform distribution, each read may be considered statistically independent from one another. The probability that (i) a second read occurs one read transfer time period (Trd) before the current read; and (ii) both the first and second reads map to the same bank 164 may be expressed as shown below in Equation 9:

P(B ₁)=(RD_(bb) _(—) _(read)/RD_(bb) _(—) _(max) _(—) _(read))×(1/N _(b))  (9)

Similarly, the probability that (i) another read occurs two transfer time periods (Trd) before the current read; and (ii) both reads map to the same bank 164 may be expressed as shown below in Equation 10:

P(B ₂)=(RD_(bb) _(—) _(read)/RD_(bb) _(—) _(max) _(—) _(read))×(1/(N _(b)−1))  (10)

The bank collision probability (Pbn), e.g., the probability that the current read maps to the same bank 164 as a read that occurred n read transfer time periods (Trd) ago, may be generalized as shown below in Equation 11:

$\begin{matrix} {{P\left( B_{n} \right)} = \left\{ \begin{matrix} {0,} & {{n < 1},{n \geq {RD}_{{bb\_ max}{\_ read}}},} \\ {\frac{{UTIL}_{percentage}}{N_{b} - n + 1},} & {{1 \leq n},{n < {RD}_{{bb\_ max}{\_ read}}},{n < N_{b}}} \\ {{UTIL}_{percentage},} & {N_{b} \leq n < {RD}_{{bb\_ max}{\_ read}}} \end{matrix} \right.} & (11) \end{matrix}$

For the purposes of Equation 2, e.g., Tbb_delay_average, P(RDn) should use non-overlapping probabilities. For example, the probability that (i) another read occurs two read transfer time periods (Trd) before the current read; (ii) both reads map to the same bank 164; and (iii) any read during the first read transfer time period (Trd) did not map to the same bank 164, may be expressed as shown below in Equation 12:

P(RD₂)=P(B ₂)×(1−P(B ₁))  (12)

Accordingly, the probability P(RDn) may be expressed as shown below in Equation 13:

$\begin{matrix} {{P\left( {RD}_{n} \right)} = \left\{ \begin{matrix} {{{P\left( B_{n} \right)} \times {\prod\limits_{k = 1}^{n - 1}\; \left\lbrack {1 - {P\left( B_{n - k} \right)}} \right\rbrack}},} & {{n < 1},{n \geq {RD}_{{bb\_ max}{\_ read}}}} \\ {{\prod\limits_{k = 1}^{n - 1}\; \left\lbrack {1 - {P\left( B_{n - k} \right)}} \right\rbrack},} & {n = {RD}_{{bb\_ max}{\_ read}}} \end{matrix} \right.} & (13) \end{matrix}$

FIG. 3 Access Time

With the definition of P(RDn) as expressed in Equation 13, Tram_access_average may be observed in terms of the average penalty due to the bank busy window (Tbb_delay_average) and the maximum number of reads that occur during a bank busy window (RDbb_max_read). For instance, in the example shown in FIG. 3, values of Tbb_delay_average are shown for RDbb_max_read=10. As shown in FIG. 3, as bandwidth utilization (UTILpercentage) approaches zero, the average DRAM access time (Tram_access_average) approaches the ideal minimum access time (Tram_access_min). As the number of banks in a memory subsystem (Nb) increases, the average DRAM access time (Tram_access_average) also approaches the ideal minimum access time (Tram_access_min). Generally, as long as Nb>>RDbb_max_read, Tram_access_min may be considered a good approximation of the average DRAM access time.

FIG. 4 Average Delay Caused by Bank Collisions

Typically, for systems at 100% utilization, e.g., UTILpercentage=100%, that have the same number of banks (Nb) as time slots within the bank busy window (RDbb_max_read), a read may be expected to incur, on average, about 50% of the bank busy window as an access delay. FIG. 4 is derived from FIG. 3 and shows an example of the average delay (Tbb_delay_average) caused by bank busy collisions as bandwidth utilization (UTILpercentage) varies, where Nb=RDbb_max_read=10. As shown in FIG. 4, however, the actual average delay is 4.5, and not 5, e.g., 50% of RDbb_max_read. Because the maximum bank busy delay that a read can experience is RDbb_max_read−1, the average delay will be about 50% of the maximum, e.g., in the example shown in FIG. 4, the average delay is 4.5. This “RDbb_max_read−1” factor may also be observed in FIG. 3, where the maximum average delay is shown as 9 when Nb=1, even though RDbb_max_read=10.

For the case of a simple demand-driven read access, the read latency (Tdemand_read) may be expressed as the sum of the latency incurred by a cache miss (Tcache_miss), the latency incurred by a memory space coherency protocol interrogation (Tcoherency_check), and the RAM latency (Tram_access), as shown below in Equation 14:

T _(demand) _(—) _(read) =T _(cache) _(—) _(miss) +T _(coherency) _(—) _(check) +T _(ram) _(—) _(access)  (14)

From the point of view of the memory controller, Tcache_miss appears to be a fixed value, contributing the same latency to each read. As discussed above, the contribution of Tram_access to latency requires an analysis of several factors, including the probability of certain types of address conflicts, bandwidth utilization, and DRAM constraints, for example. To the memory controller, both Tcache_miss and Tram_access are values over which the memory controller has little to no control. The memory controller can choose to start accessing RAM early, however, prior to receiving the results of the system's coherency protocol, e.g., a speculative read. In the best case scenario, a speculative read may reduce the read latency by effectively eliminating Tcoherency_check, as shown below in Equation 15:

T _(spec) _(—) _(read) =T _(cache) _(—) _(miss) +T _(ram) _(—) _(access)  (15)

In an idealized system with infinite memory subsystem bandwidth, all reads could be dispatched speculatively to maximize performance. Unfortunately, in systems with large memory spaces, there are several practical considerations that place an upper limit on memory subsystem bandwidth (BWmc_read_max), e.g., finite transistor counts, limitations within RAM systems (e.g., open pages, bank activates, etc.), among other factors. The practical effect of limited bandwidth is that any read received by the memory controller, either demand based or speculative, cannot be serviced if resources are unavailable.

One implication of Equations 14 and 15 is that a read request speculatively dispatched immediately upon receipt tends to have the greatest potential to achieve the full Tcoherency_check latency savings shown by Equation 15. The longer the wait between receipt of a read request and the decision to dispatch speculatively, the lower the potential latency savings and the less dramatic the improvement of the effective latency relative to Equation 14. In some examples (e.g., discussed below in connection with FIG. 8, Equation 47, and Table 1), a system may achieve improved performance by prioritizing “new” read requests while effectively expiring “older” read requests from speculative read consideration. For example, an example may include a time expiration on read requests: read requests received recently are of higher value to a speculative read policy than older read requests. In some examples, read request are not speculatively dispatched greater than or equal to Tcoherency_check after initial receipt, e.g., the coherency logic's response may be expected at any moment, thereby eliminating any advantage of dispatching speculatively.

A speculative read that results in a miss, e.g., the coherency protocol indicates that the read was actually not needed, results in wasted bandwidth within the memory controller. A speculative read that the coherency protocol later validates is viewed as a “hit.” Instead of choosing to dispatch a read speculatively, the memory controller may wait for the results from the coherency protocol before issuing a read, e.g., a demand read. The memory subsystem bandwidth (BWmc_read_max) serves as the upper limit on the total bandwidth used by speculative hits and misses (BWmc_spec_read_hit and BWmc_spec_read_miss) plus the bandwidth used for demand reads (BWmc_demand_read), as shown below in Equation 16:

BW_(mc) _(—) _(read) _(—) _(max)≧BW_(mc) _(—) _(spec) _(—) _(read) _(—) _(hit)+BW_(mc) _(—) _(spec) _(—) _(read) _(—) _(miss)+BW_(mc) _(—) _(demand) _(—) _(read)  (16)

Bandwidth limitations may also be expressed in terms of the maximum number of reads that may be in-progress simultaneously. For example, the upper limit of the memory subsystem bandwidth (BWmc_read_max) may be expressed as the total number of reads that the memory system can process (RDmc_max) in a finite amount of time (Tmc_max), as shown below in Equations 17-22, where RDmc_current is the current count of reads, RDmc_spec_miss is the current number of speculative reads that result in hits, RDmc_spec miss is the number of speculative reads that result in misses, and RDmc_demand is the current number of demand reads:

$\begin{matrix} {{BW}_{{mc\_ read}{\_ max}} = \frac{{RD}_{mc\_ max}}{T_{mc\_ max}}} & (17) \\ {{RD}_{mc\_ current} = {{RD}_{{mc\_ spec}{\_ hit}} + {RD}_{{mc\_ spec}{\_ miss}} + {RD}_{mc\_ demand}}} & (18) \\ {{RD}_{mc\_ max} \geq {RD}_{mc\_ current}} & (19) \\ {{BW}_{{mc\_ spec}{\_ read}{\_ hit}} = {\frac{{RD}_{{mc\_ spec}{\_ hit}}}{{RD}_{mc\_ max}} \times {BW}_{{mc\_ read}{\_ max}}}} & (21) \\ {{BW}_{{mc\_ demand}{\_ read}} = {\frac{{RD}_{mc\_ demand}}{{RD}_{mc\_ max}} \times {BW}_{{mc\_ read}{\_ max}}}} & (22) \end{matrix}$

Conventional computer systems typically implement an interconnect bus with a bandwidth (BWsystem_read_max) that exceed the memory subsystem's ability to access physical RAM (BWmc_read_max). This excess in the interconnect bus bandwidth provides the ability to implement a number of coherency protocol techniques, including grouping multiple L2 caches into a larger common cache space; and eliminating the need to access physical RAM in those cases where a cache-miss from one L2 cache can be satisfied by data within a different L2 cache. The capabilities of modern coherency protocols should be considered when implementing a memory controller based speculative read policy. Furthermore, because the rate of read requests presented to the systems' memory coherency protocol (BWsystem_read) changes dynamically under varying system loads, the speculative read policy should be capable of adapting to both changing read request patterns and available memory controller resources.

FIG. 5 Relationship Between Read Types

Read requests presented to the coherency protocol (RDtotal_system) represent the total pool of reads from which the memory controller must choose when making speculative dispatch decisions. Once the coherency protocol confirms which reads need to be handled by the memory controller, a subset of raw system reads becomes available (RDtotal_system_demand). Memory controller demand reads (RDtotal_mc_demand) always pull from the system demand read pool (RDtotal_system_demand). However, while all speculative reads (RDtotal_mc_spec) pull from the raw system reads pool (RDtotal_system), speculative reads that result in hits (RDtotal_mc_spec_hit) also share membership in the system demand read set (RDtotal_system_demand). The relationship between these read types are shown in FIG. 6, a Venn set diagram, and in Equations 23-28, as shown below:

RD_(total) _(—) _(system)≧RD_(total) _(—) _(system) _(—) _(demand)∪RD_(total) _(—) _(mc) _(—) _(spec)  (23)

RD_(total) _(—) _(mc) _(—) _(spec)=RD_(total) _(—) _(mc) _(—) _(spec) _(—) _(hit)+RD_(total) _(—) _(mc) _(—) _(spec) _(—) _(miss)  (24)

RD_(total) _(—) _(mc) _(—) _(spec) _(—) _(hit)=RD_(total) _(—) _(system) _(—) _(demand)∩RD_(total) _(—) _(mc) _(—) _(spec)  (25)

RD_(total) _(—) _(mc) _(—) _(spec) _(—) _(miss)=RD_(total) _(—) _(mc) _(—) _(spec)−RD_(total) _(—) _(mc) _(—) _(spec) _(—) _(hit)  (26)

RD_(total) _(—) _(mc) _(—) _(demand)=RD_(total) _(—) _(system) _(—) _(demand)−RD_(total) _(—) _(mc) _(—) _(spec) _(—) _(hit)  (27)

RD_(total) _(—) _(mc)=RD_(total) _(—) _(mc) _(—) _(spec)+RD_(total) _(—) _(mc) _(—) _(demand)  (28)

As shown in FIG. 6, set 184 correspond to RDtotal_system, set 186 correspond to RDtotal_system_demand, set 188 corresponds to RDtotal_mc_spec, and set 190 corresponds to RDtotal_mc_spec_hit.

A goal of a speculative read policy is to reduce the average read latency to a value less than a normal demand read, as shown below in Equation 29:

T_(average) _(—) _(read)≦T_(demand) _(—) _(read)  (29)

Any speculative read algorithm resulting in the average read latency exceeding that of a demand read will typically adversely affect system performance. Three discrete scenarios may be considered in generating an optimal speculative read policy, as shown below in Equations 30-32:

1) BW_(system) _(—) _(read)≦BW_(mc) _(—) _(max)  (30)

2) BW_(system) _(—) _(read) _(—) _(demand)≦BW_(mc) _(—) _(max)<BW_(system) _(—) _(read)  (31)

3) BW_(mc) _(—) _(max)<BW_(system) _(—) _(read) _(—) _(demand)≦BW_(system) _(—) _(read)  (32)

For each of the scenarios shown in Equations 30-32, a speculative read policy typically needs to consider only those reads that occur within a fixed time interval (Tmc_read_max). Because a read will complete within the memory controller every Tmc_read_max cycles, regardless of whether the read is a speculative hit, miss or demand read, only those reads that occurred during the previous window need to be examined. This window, e.g., a moving average, may be equivalent to the system read bandwidth as measured on a particular cycle (BWsystem_read[n]), as shown below in Equation 33:

$\begin{matrix} \begin{matrix} {{{{BW}_{system\_ read}\lbrack n\rbrack} = {\frac{1}{T_{{mc\_ read}{\_ max}}} \times {\sum\limits_{k = 0}^{({T_{{mc\_ read}{\_ max}} - 1})}{{RD}_{system}\left\lbrack {n - k} \right\rbrack}}}},} \\ {{{where}\mspace{14mu} {{RD}_{system}\lbrack n\rbrack}} = \left\{ \begin{matrix} {0,{{when}\mspace{14mu} {no}\mspace{14mu} {read}\mspace{14mu} {request}\mspace{14mu} {occured}\mspace{14mu} {on}\mspace{14mu} {cycle}\mspace{14mu} \# n}} \\ {1,{{read}\mspace{14mu} {request}\mspace{14mu} {occurred}\mspace{14mu} {on}\mspace{14mu} {cycle}\mspace{14mu} \# n}} \end{matrix} \right.} \end{matrix} & (33) \end{matrix}$

In the event that the system's current status matches the scenario shown in Equation 30, all system reads may be dispatched speculatively by the memory controller without regard for speculative hit/miss ratios. The basis for this policy may be shown in the examination of average number of cycles per read as shown below in Equations 34-35:

$\begin{matrix} {T_{average\_ read} = {{\frac{{RD}_{{mc\_ spec}{\_ hit}}}{{RD}_{mc}} \times T_{spec\_ read}} + {\frac{{RD}_{{mc\_ spec}{\_ miss}}}{{RD}_{mc}} \times T_{spec\_ read}} + {\frac{{RD}_{mc\_ demand}}{{RD}_{mc}} \times T_{demand\_ read}}}} & (34) \\ {{RD}_{mc} = {{RD}_{{mc\_ spec}{\_ hit}} + {RD}_{{mc\_ spec}{\_ miss}} + {RD}_{mc\_ demand}}} & (35) \end{matrix}$

If the memory controller speculatively dispatches all reads, Equation 34 may be simplified as shown below in Equation 36:

$\begin{matrix} \begin{matrix} {T_{average\_ read} = {{\frac{\left( {\left( {1 - {RD}_{{mc\_ spec}{\_ miss}}} \right) + {RD}_{{mc\_ spec}{\_ miss}}} \right)}{\left( {1 - {RD}_{{mc\_ spec}{\_ miss}} + {RD}_{{mc\_ spec}{\_ miss}} + 0} \right)} \times T_{spec\_ read}} +}} \\ {{\frac{0}{\left( {1 - {RD}_{{mc\_ spec}{\_ miss}} + {RD}_{{mc\_ spec}{\_ miss}} + 0} \right)} \times T_{demand\_ read}}} \\ {= T_{spec\_ read}} \end{matrix} & (36) \end{matrix}$

The result shown in Equation 36 stems from the ability of the system to effectively ignore the wasted bandwidth of the speculative misses (BWmc_spec_read_miss). Accordingly, as long as sufficient bandwidth exists to absorb the loss from wasted speculative misses, all reads should be dispatched speculatively by the memory controller. This analysis assumes that the memory controller is able to handle the incoming rate of reads, as shown below in Equation 37:

BW_(system) _(—) _(read)≦BW_(mc) _(—) _(spec) _(—) _(read) _(—) _(hit)+BW_(mc) _(—) _(spec) _(—) _(read) _(—) _(miss)≦BW_(mc) _(—) _(read) _(—) _(max)  (37)

To evaluate a speculative read policy for general use, however, situations in which the system read requests exceed the memory controller's ability to process them should be considered. Because a memory controller can only process a finite number of reads (RDmc_max) in a given length of time (Tmc_read_max), any reads that exceed the memory controller's maximum rate will increase the average access time. Additionally, when a read cannot be accepted due to insufficient memory controller resources, the read incurs a retry penalty where the system waits for a period of time (Tmc_retry) before retrying the failed read operation. For a system where the retry period is less than the time required to complete a read, a read may need to be retried multiple times before the memory controller has capacity to accept it. The number of multiple retries increases as the requested reads increase and as the system retry period decreases. The effect of the retry penalty is shown below in Equations 38-42:

$\begin{matrix} {{UTIL}_{{mc\_ excess}{\_ percentage}} = \left\{ \begin{matrix} {0,} & {{BW}_{mc\_ total} \leq {BW}_{mc\_ max}} \\ {\frac{{BW}_{mc\_ total} - {BW}_{mc\_ max}}{{BW}_{mc\_ max}},} & {{BW}_{mc\_ total} > {BW}_{mc\_ max}} \end{matrix} \right.} & (38) \\ {{UTIL}_{{mc\_ retry}{\_ percentage}} = {T_{mc\_ retry}/T_{{mc\_ read}{\_ max}}}} & (39) \\ {N_{max\_ retries} = \frac{{UTIL}_{{mc\_ excess}{\_ percentage}}}{{UTIL}_{{mc\_ retry}{\_ percentage}}}} & (40) \\ {{T_{{mc\_ retry}{\_ total}} = {\sum\limits_{k = 0}^{{int}{(N_{max\_ retries})}}{k \times T_{mc\_ retry}}}},{k = 0},1,2,\ldots \mspace{14mu},{{{int}\left( N_{max\_ retries} \right)} + {\left( {{{int}\left( N_{max\_ retries} \right)} + 1} \right) \times \left( {N_{max\_ retries} - {{int}\left( N_{max\_ retries} \right)}} \right) \times T_{mc\_ retry}}}} & (41) \\ {T_{{mc\_ retry}{\_ avg}} = {T_{{mc\_ retry}{\_ total}} \times \frac{{UTIL}_{{mc\_ retry}{\_ percentage}}}{\left( {{BW}_{mc\_ total}/{BW}_{mc\_ max}} \right)}}} & (42) \end{matrix}$

In addition to any retry penalty, the effect on Tram_access (in Equations 14 and 15) may be represented by the ratio of requested memory controller bandwidth (BWmc_total) to maximum memory controller bandwidth (BWmc_max), as shown below in Equations 43 and 44:

$\begin{matrix} \begin{matrix} {T_{spec\_ read} = \begin{matrix} {{T_{cache\_ miss} + T_{ram\_ access}},} & \left\{ {\frac{{BW}_{mc\_ total}}{{BW}_{mc\_ max}} \leq {100\%}} \right. \end{matrix}} \\ {= \begin{matrix} {T_{cache\_ miss} + {T_{ram\_ access} \times}} & {\frac{{BW}_{mc\_ total}}{{BW}_{mc\_ max}} +} \end{matrix}} \\ {\begin{matrix} {T_{{mc\_ retry}{\_ avg}},{> {100\%}}} & \left\{ \frac{{BW}_{mc\_ total}}{{BW}_{mc\_ max}} \right. \end{matrix}} \end{matrix} & (43) \\ {T_{demand\_ read} = {T_{coherency\_ check} + T_{spec\_ read}}} & (44) \end{matrix}$

By combining Equations 3, 28, 34, 43 and 44, a model may be defined to evaluate the effects of a speculative read policy on average read latency. These Equations include the following system-specific constants: Trd, Ta, Tbb, T cache_miss, Tcoherency_check, Tmc_read_max, Tmc_retry and BWmc_max. In addition, the following model parameters, BWmc_spec, BWsystem_read, and DEMAND_READpercent, may be used to define the requested memory controller bandwidth (BWmc_total) that will effect average read latency. BWmc_spec is the maximum bandwidth of the memory controller that is allowed for use on speculative read operations. Generally, BWmc_spec must be less then or equal to BWmc_max. BWsystem_read is the bandwidth associated with system reads, e.g., read requests, prior to coherency a check and any resulting demand reads. DEMAND_READpercent is the percentage of system reads that, after undergoing a coherency check, are system demand reads that require data from the memory controller. The relationship between these parameters and BWmc_total is shown below in Equations 45 and 46.

$\begin{matrix} {{BW}_{mc\_ demand} = \left\{ \begin{matrix} {0,} & {{BW}_{system\_ read} \leq {BW}_{mc\_ spec}} \\ {{\left( {{BW}_{system\_ read} - {BW}_{mc\_ spec}} \right) \times {DEMAND\_ READ}_{percent}},} & {{BW}_{system\_ read} > {BW}_{mc\_ spec}} \end{matrix} \right.} & (45) \\ {{BW}_{mc\_ total} = \left\{ \begin{matrix} {{BW}_{system\_ read},} & {{BW}_{system\_ read} \leq {BW}_{mc\_ spec}} \\ {{{BW}_{mc\_ spec} + {BW}_{mc\_ demand}},} & {{BW}_{system\_ read} > {BW}_{mc\_ spec}} \end{matrix} \right.} & (46) \end{matrix}$

FIG. 6 Average Read Latency with 25% System Demand Reads

FIG. 6 shows an example of a read latency graph. For the purposes of simplicity, units of time as used herein for the discussion of FIG. 6 are defined in terms of the read transfer time (Trd) and constants related to time will be defined as a multiple of Trd. To avoid the need to explicitly specify the maximum memory controller bandwidth (BWmc_max), all bandwidth variables as used herein will be graphed in terms of a percentage of BWmc_max, where (i) (BWmc_spec)/(BWmc_max)≦100%; and (ii) (BWsystem_read)/(BWmc_max)≦400%. FIG. 6 shows the average read latency (in Trd units) on the Z-axis, the allowed speculative bandwidth as a percentage of maximum memory controller bandwidth (BWmc_spec/BWmc_max) on the X-axis, and the total system read bandwidth as a percentage of maximum memory controller bandwidth (BWsystem_read/BWmc_max) on the Y-axis. For the example illustrated in FIG. 6, DEMAND_READpercent=25% (fixed), Trd=1, Ta=10 Trd; Tbb=10 Trd; Nb=2(Tbb/Trd)=20; Tcache_miss=Trd, Tcoherency_check=5 Trd; Tmc_read_max=2 Ta=20 Trd; and Tmc_retry=Tmc_read_max=20 Trd.

Referring to FIG. 6, there are three main regions of operation for the memory controller. Region 193 is where all reads are dispatched speculatively. Region 194 is where some reads are speculative but all reads may be handled by the memory controller. Region 196 is where the memory controller is overwhelmed and retries are issued. The absolute read latency may be normalized by dividing the read latency when no speculative reads are issued to provide a simple percentage. If the normalized read latency is less than 100%, e.g., less than one, then speculative reads will improve performance. Conversely, if the normalized read latency is greater than 100%, speculative reads will have a negative impact on performance.

FIGS. 7 a-7 f Normalized Read Latency

FIGS. 7 a-7 f show normalized read latency graphs in which DEMAND_READpercentage has been varied from 10%, 25%, 40%, 55%, 70%, and 85%, respectively. In each FIG. 7 a-7 f, line 198 indicates the lowest possible read latency for a given (BWsystem_read/BWmc_max) ratio, shown on the X-axis, i.e., an ideal. Line 200 shows a linear approximation or linear curve fit of line 198 that would allow a system to improve read latency by adjusting speculative read threshold percentages. Line 200 substantially corresponds to Equation 47 for the approximated speculative read threshold, discussed below.

FIG. 8 Interconnect Schematic for Algorithm to Reduce Read Latency

Adjusting the allowed percentage of speculative read requests based upon selected computer system states, such as memory controller workload and the rate of incoming requests, allows for a reduction in memory read latency. In one example, shown in FIG. 8, a computer system may utilize an algorithm to dynamically intermix demand and speculative memory requests to reduce memory read latency, i.e., regularly updating or computing the percentage of speculative read requests by continuously monitoring memory controller resources and system read rates. FIG. 8 is an interconnect schematic 212 for the speculative read threshold algorithm functions suitable for computer system 100 (shown in FIG. 1). System read monitor 202 monitors the system read request rate being presented to the memory controller prior to the coherency check (BWsystem_read). Because the maximum read rate of the memory controller may be a constant (BWmc_max), system read monitor 202 may provide data as a percentage relative to the maximum memory controller read rate (BWsystem_read/BWmc_max). System demand read monitor 204 monitors the percentage of system read requests that pass coherency checking and require data from the memory controller (DEMAND_READpercent). Memory controller speculative read monitor 206 monitors the percentage of memory controller resources currently being used for speculative reads (BWmc_spec_current/BWmc_max). Memory controller full monitor 208 monitors whether the memory controller can accept any more reads (BOOLEANmc_full). Speculative threshold decision function 210 receives data from monitors 202, 204, 206 and 208 and outputs BOOLEANspec_dispatch.

The speculative read threshold (BWmc_spec/BWmc_max) may be approximated by speculative threshold decision function 210 implementing the following equation:

$\begin{matrix} \begin{matrix} {\frac{{BW}_{mc\_ spec}}{{BW}_{mc\_ max}} = {{{- 1} \times \frac{{BW}_{system\_ read}}{{BW}_{mc\_ max}} \times \frac{{DEMAND\_ READ}_{percent}}{1 - {Demand\_ READ}_{percent}}} +}} \\ {{= \frac{1}{1 - {Demand\_ READ}_{percent}}},\left\{ {\frac{{BW}_{system\_ read}}{{BW}_{mc\_ max}} > 1} \right.} \\ {= {1.\left\{ {\frac{{BW}_{system\_ read}}{{BW}_{mx\_ max}} \leq 1} \right.}} \end{matrix} & (47) \end{matrix}$

In some examples, computer system 100 may have the option of delaying the speculative decision. For example, memory controller 108 may be full when the read request is first received, but a speculative decision may be made at the point when memory controller 108 is no longer full. Typically, a computer system realizes the greatest benefit in latency reduction when a speculative read is dispatched immediately. As the time period between receiving the read request and dispatching the speculative read increases, the benefit decreases.

Accordingly, the decision to dispatch speculatively may also be based on the amount of time from the initial request until the memory resources needed to fulfill the request become available (Treq). In some examples, computer system 100 may place a time limit on requests using a threshold for how long after a request arrives it may be eligible for speculative dispatch, (Treq_expired). In one example, the speculative dispatch time threshold (Treq_expired) is a selected percentage of the amount of time required to search a cache system of the computer system. The speculative dispatch time threshold (Treq_expired) may also be programmed or dynamically adjusted based on system parameters, such as memory controller workload and the rate of incoming requests.

Read expiration timer 211 verifies that a read request is recent enough to be considered for speculative dispatch (BOOLEANreq_expired), and the current read request being considered is the youngest available (BOOLEANyounger_req_avail). For example, if Treq≧Treq_expired, then BOOLEANreq_expired=true. Logic 160 may include queue 161 for pending read requests.

The decision (BOOLEANspec_dispatch) as to whether a read, e.g., pre-coherency check, should be speculatively dispatched may be based on the truth table shown below in TABLE 1:

Inputs Output (BOOLEAN_(spec)_dispatch) $\frac{{BW}_{{mc}{\; \;}{current}\mspace{14mu} {spec}}}{{BW}_{{mc}{\; \;}\max}} \geq \frac{{BW}_{{mc}{\mspace{11mu} \;}{spec}}}{{BW}_{{mc}\mspace{14mu} \max}}$ NO, do not dispatch speculatively BOOLEAN_(mc full) = true NO, do not dispatch speculatively BOOLEAN_(req expired) = true NO, do not dispatch speculatively BOOLEAN_(younger req avail) = true NO, do not dispatch speculatively otherwise, YES, dispatch speculatively

The speculative read threshold is regularly updated/computed by monitoring memory controller resources and system read rates. As different programs run in a computer, the pattern of read requests will change. The speculative read threshold algorithm may allow a hardware circuit to dynamically adapt to the constantly changing pattern of read requests as the system load changes over time. The speculative read threshold may be set based on the pattern of read requests (DEMAND_READpercent), system load (BWsystem_read/BWmc_max), and memory controller load (BWmc_spec_current/BWmc_max and BOOLEANmc_full). As a result, the disclosed system and method may remain effective as memory subsystems become more complex (e.g., multiple levels of memory hierarchy, multiple cores, multi-node/multi-bade systems, coherent memory space).

Because monitors 202, 204, 206 and 208 monitor various system and memory controller states, efficient function realization may require an examination in view of control system theory. Other examples may allow the output of the functions to either lead or lag the actual measured state to provide the ability to tune the total algorithm's effectiveness for a specific system and memory controller implementation or configuration. Some examples may use integer-only coding to simplify and minimize circuitry components. Conventional techniques for conversion of floating point algorithms to integer-only may be used.

Given the underlying non-linear nature of the “ideal” read threshold algorithm, the error term associated with linear-curve fit equation shown in Equation 47 may grow as the READ_DEMANDpercent approaches either 0% or 100%. For example, as shown in FIGS. 7 a-7 f, the example of the read threshold algorithm shown in Equation 47 has the greatest accuracy, i.e., compared to the ideal 198, over a READ_DEMANDpercent range of 25%-85%. To minimize the error term, various standard techniques may be used to generate a more discrete curve fit equation, such as additional linear segments, and table lookups, among other techniques.

FIG. 9 Design Structure

FIG. 9 shows a block diagram of an exemplary design flow 900 used for example, in semiconductor design, manufacturing, and/or test. Design flow 900 may vary depending on the type of IC being designed. For example, a design flow 900 for building an application specific IC (ASIC) may differ from a design flow 900 for designing a standard component. Design structure 920 is preferably an input to a design process 910 and may come from an IP provider, a core developer, or other design company or may be generated by the operator of the design flow, or from other sources. Design structure 920 comprises the circuits described above and shown in FIGS. 1, 2 and 8 in the form of schematics or HDL, a hardware-description language (e.g., Verilog, VHDL, C, etc.). Design structure 920 may be contained on one or more machine readable medium. For example, design structure 920 may be a text file or a graphical representation of a circuit as described above and shown in FIGS. 1, 2 and 8. Design process 910 preferably synthesizes (or translates) the circuit described above and shown in FIGS. 1, 2 and 8 into a netlist 980, where netlist 980 is, for example, a list of wires, transistors, logic gates, control circuits, I/O, models, etc. that describes the connections to other elements and circuits in an integrated circuit design and recorded on at least one of machine readable medium. For example, the medium may be a storage medium such as a CD, a compact flash, other flash memory, or a hard-disk drive. The medium may also be a packet of data to be sent via the Internet, or other networking suitable means. The synthesis may be an iterative process in which netlist 980 is resynthesized one or more times depending on design specifications and parameters for the circuit.

Design process 910 may include using a variety of inputs; for example, inputs from library elements 930 which may house a set of commonly used elements, circuits, and devices, including models, layouts, and symbolic representations, for a given manufacturing technology (e.g., different technology nodes, 32 nm, 45 nm, 90 nm, etc.), design specifications 940, characterization data 950, verification data 960, design rules 970, and test data files 985 (which may include test patterns and other testing information). Design process 910 may further include, for example, standard circuit design processes such as timing analysis, verification, design rule checking, place and route operations, etc. One of ordinary skill in the art of integrated circuit design can appreciate the extent of possible electronic design automation tools and applications used in design process 910 without deviating from the scope and spirit of the invention. The design structure of the invention is not limited to any specific design flow.

Design process 910 preferably translates a circuit as described above and shown in FIGS. 1, 2 and 8, along with any additional integrated circuit design or data (if applicable), into a second design structure 990. Design structure 990 resides on a storage medium in a data format used for the exchange of layout data of integrated circuits (e.g. information stored in a GDSII (GDS2), GL1, OASIS, or any other suitable format for storing such design structures). Design structure 990 may comprise information such as, for example, test data files, design content files, manufacturing data, layout parameters, wires, levels of metal, vias, shapes, data for routing through the manufacturing line, and any other data required by a semiconductor manufacturer to produce a circuit as described above and shown in FIGS. 1, 2 and 8. Design structure 990 may then proceed to a stage 995 where, for example, design structure 990: proceeds to tape-out, is released to manufacturing, is released to a mask house, is sent to another design house, is sent back to the customer, etc.

From the foregoing detailed description of specific examples of the invention, it should be apparent that a system and method handling data requests based on available system resources has been disclosed. Although specific examples of the invention have been disclosed herein in some detail, this has been done solely for the purposes of describing various features and aspects of the invention, and is not intended to be limiting with respect to the scope of the invention. It is contemplated that various substitutions, alterations, and/or modifications, including but not limited to those implementation variations which may have been suggested herein, may be made to the disclosed examples without departing from the spirit and scope of the invention as defined by the appended claims which follow. 

1. A design structure embodied in a machine readable storage medium for at least one of designing, manufacturing, and testing a design, the design structure comprising: a computer system comprising a CPU; a memory controller; memory; a bus connecting the CPU, memory controller and memory; circuitry for providing a speculative read threshold corresponding to a selected percentage of the total number of reads that can be speculatively issued; and circuitry for intermixing demand reads and speculative reads in accordance with the speculative read threshold.
 2. The design structure of claim 1, further comprising: circuitry for monitoring a selected computer system state; and circuitry for dynamically adjusting the speculative read threshold based on the selected computer system state.
 3. The design structure of claim 2, further comprising circuitry for preventing a read request from dispatching as a speculative read request if the percentage of current memory controller resources being used for speculative reads is equal to or greater than the speculative read threshold.
 4. The design structure of claim 3, further comprising circuitry for preventing the read from dispatching as a speculative read if the memory controller is full.
 5. The design structure of claim 4, further comprising circuitry for determining the speculative read threshold based on a system read request rate.
 6. The design structure of claim 5, further comprising circuitry for determining the speculative read threshold based on a percentage of read requests that pass coherency checking and require data from the memory controller.
 7. The design structure of claim 1, wherein the design structure comprises a netlist, which describes the computer system.
 8. The design structure of claim 1, wherein the design structure resides on the machine readable storage medium as a data format used for the exchange of layout data of integrated circuits. 